<template>
	<view class="sample">
		<top-nav>
			<view class="top-nav-content">
				<view class="title">矿池</view>
				<!-- <view class="right">查看矿机</view> -->
			</view>
		</top-nav>
		<view class="banner"></view>
		<view class="info">需要账户有{{sampleInfo.usable}}U，30个燃料！<br>可以聚合成一个{{sampleInfo.money}}U的矿池</view>
		<view class="degree" @click="clickFun">开始聚合</view>
		<view class="desc">燃料不足，请及时兑换</view>
		<u-toast ref="uToast" />
		<bottom-nav :currentIndex="3"></bottom-nav>
	</view>
</template>

<script>
	import topNav from '../../components/top-nav/top-vue.vue';
	import bottomNav from '../../components/bottom-nav/bottom-nav.vue';
	import myButton from '../login/components/button.vue'
	export default{
		components:{
			topNav:topNav,
			bottomNav:bottomNav,
			myButton:myButton
		},
		data(){
			return {
				show: true,
				noticeShow: true,
				state: 0,
				sampleInfo: {
					usable:20,
					money:200
				}
			}
		},
		mounted() {
			if(this.state){
				uni.navigateTo({
				    url: '/pages/groupBuying/groupBuying'
				});
				return false
			}
			this.$u.post('/api/getIsLtc', {account_id:uni.getStorageSync('account_id')}).then(res=>{
				if(res.code==200){
					this.state = res.data.state;
					if(this.state){
						uni.navigateTo({
						    url: '/pages/groupBuying/groupBuying'
						});
					}
				} else {
					this.$refs.uToast.show({
						title: res.message,
						type: 'error',
					})
				}
			})
		},
		methods:{
			clickFun(){
				this.$u.post('/api/musterLtc', {account_id:uni.getStorageSync('account_id')}).then(res=>{
					if(res.code==200){
						this.$refs.uToast.show({
							title: res.message,
							type: 'success',
						})
						uni.navigateTo({
						    url: '/pages/groupBuying/groupBuying'
						});
					} else {
						this.$refs.uToast.show({
							title: res.message,
							type: 'error',
						})
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.sample{
		margin-bottom:140rpx;
	}
	.top-nav-content{
		width:100%;
		display: flex;
		align-items: center;
		position:relative;
		.title{
			flex:1;
			text-align: center;
			font-size:24*2rpx;
		}
		.right{
			position:absolute;
			right:40rpx;;
			top:0;
			height:100%;
			display: flex;
			align-items: center;
		}
	}
	.banner{
		width:375*2rpx;
		height:237*2rpx;
		background-image: url('/static/sample/banner.png');
		background-size: 100% 100%;
		margin-top: 40*2rpx;
	}
	.info{
		width: 281*2rpx;
		height: 65*2rpx;
		background: rgba(105, 218, 115, 0.1);
		border: 1px solid #69DA73;
		text-align: center;
		margin:66*2rpx auto 47*2rpx;
		padding:12*2rpx 33*2rpx;
	}
	.desc{
		text-align: center;
		font-size:12*2rpx;
		color:#FFB721;
	}
	.degree{
		width: 216*2rpx;
		height: 61*2rpx;
		background: #69DA73;
		display: flex;
		align-items: center;
		justify-content: center;
		margin: 0 auto 16*2rpx;
		font-size: 24*2rpx;
		font-family: WenCang-Regular, WenCang;
	}
	.popup-content{
		width:375*2rpx;
		height:483*2rpx;
		position:relative;
		background-image: url('/static/home/Group@2x.png');
		background-size: 100% 100%;
		.close-btn{
			width:60%;
			height:110rpx;
			left:50%;
			margin-left:-30%;
			position:absolute;
			bottom:80rpx;
		}
	}
	/deep/.u-mode-center-box{
		background: none;
	}
</style>
